{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "path = '/Users/sinyeratlantis/Downloads/MP4/'\n",
    "\n",
    "prefix = path + os.sep  # os.sep添加系统分隔符\n",
    "\n",
    "files = os.listdir(path)  # 获取该目录下所有文件名，存入列表中\n",
    "\n",
    "n = 0\n",
    "for i in files:  # 输出检测下会不会出现改错名字的可能\n",
    "    oldname = files[n]\n",
    "    newname = files[n][:-30] + '.mp4'  # 更改后缀\n",
    "    \n",
    "    if oldname[0] != '.' and not os.path.isdir(prefix + oldname):  # 跳过隐藏文件和文件夹\n",
    "        print(oldname, '==>', newname)\n",
    "    \n",
    "    n += 1"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
